import request from './request'

export function query ({currentPage = 1, perPage = 10,columnId} = {}) {
  return request({
    url: '/console/content/queryContentList.do',
    method: 'POST',
    body: {currentPage, perPage,columnId}
  })
}
//详情
export function detail (id) {
  return request({
    url: '/console/content/queryByContentIdDetails.do',
    method: 'POST',
    body: {id}
  })
}

export function queryMenuAll () {
  return request({
    url: '/console/product/queryAllInfo.do',
    method: 'POST'
  })
}

export function queryPro (id) {
  return request({
    url: '/console/product/queryInfo.do',
    method: 'POST',
    body: {id}
  })
}
//添加
export function create ({topLevel, hasTitleImg, isRecommend, status, viewsDay, contentType, title, shortTitle, author, origin, originUrl, description, mediaPath, mediaType, titleColor, isBold, titleImg, contentImg, tplContent, columnId, txt, columnList, contentPictureList, contentAttachmentList}={}) {
  return request({
    url: '/console/content/addContent.do',
    method: 'POST',
    body: {topLevel, hasTitleImg, isRecommend, status, viewsDay, contentType, title, shortTitle, author, origin, originUrl, description, mediaPath, mediaType, titleColor, isBold, titleImg, contentImg, tplContent, columnId, txt, columnList, contentPictureList, contentAttachmentList}
  })
}
//修改
export function edit ({id,topLevel, hasTitleImg, isRecommend, status, viewsDay, contentType, title, shortTitle, author, origin, originUrl, description, mediaPath, mediaType, titleColor, isBold, titleImg, contentImg, tplContent, columnId, txt, columnList, contentPictureList, contentAttachmentList}={}) {
  return request({
    url: '/console/content/editContent.do',
    method: 'POST',
    body: {id,topLevel, hasTitleImg, isRecommend, status, viewsDay, contentType, title, shortTitle, author, origin, originUrl, description, mediaPath, mediaType, titleColor, isBold, titleImg, contentImg, tplContent, columnId, txt, columnList, contentPictureList, contentAttachmentList}
  })
}


//状态修改
export function changestatus ({id, status}={}) {
  return request({
    url: '/console/content/updateStatusContent.do',
    method: 'POST',
    body: {id, status}
  })
}

//上传图片
export function uploadImg () {
  return request({
    url: '/console/upload/uploadImg.do',
    method: 'POST'
  })
}
//上传媒体文件
export function uploadFile () {
  return request({
    url: '/console/upload/uploadFile.do',
    method: 'POST'
  })
}